/**
 * 文章子路由
 */
const express = require('express');
// 导航类目中间件
const category = require('../middleware/category');
// 文章中间件
const article = require('../middleware/article');
// 权限中间件，获取用户信息
const auth = require('../middleware/auth');


const searchApp = express();
// 注册权限模块在indexApp
searchApp.use(auth.getUser);
// 文章子应用
searchApp.get('/',[category.getList,article.getListBykeywrod],(req,res)=>{
    let {category,articles,user} = req;
    res.render('search',{category,articles,keyword:req.query.keyword,user});
});

module.exports = searchApp;